import {
  ElButton,
  ElDialog,
  ElMenu,
  ElMenuItem,
  ElRadio,
  ElRadioButton,
  ElRadioGroup,
  ElIcon,
  ElInput,
  ElForm,
  ElTooltip,
  ElDescriptions,
  ElDescriptionsItem,
  ElTable,
  ElTableColumn,
  ElLink,
  // 指令
  ElLoading,
  ElImage,
  ElInfiniteScroll,
} from "element-plus";

// Directives
const plugins = [ElLoading, ElInfiniteScroll];

const components = [
  ElButton,
  ElDialog,
  ElMenu,
  ElMenuItem,
  ElIcon,
  ElRadio,
  ElRadioButton,
  ElRadioGroup,
  ElInput,
  ElForm,
  ElTooltip,
  ElDescriptions,
  ElDescriptionsItem,
  ElTable,
  ElTableColumn,
  ElLink,
  ElLoading,
  ElImage,
  ElInfiniteScroll,
];

export function useElementPlus(app) {
  // 注册组件
  components.forEach((component) => {
    app.component(component.name, component);
  });
  // 注册指令
  plugins.forEach(plugin => {
    app.use(plugin);
  });
}
